<template>
	<view class="inout-stock-page">
		<view class="panel-1  c-flex jc-between c-flex-wrap">
			<view class="item c-panel c-flex c-flex-col c-item-center jc-center"
						v-for="(item,i) in list" :key="i" @click="onItemClick(item)">
				<image :src="deliveryImgUrl+item.icon" mode=""></image>
				<view class="txt1">{{item.txt1}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapStatus,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				deliveryImgUrl: this.$API.IMG_URL + '/gas/yehuaqi/delivery/',
				list:[],
				list1:[
					{txt1:'空瓶入库',icon:'delivery-kprk.png',url:'/pages/delivery/stock-manage/instock?stockType=0',type:0},
					{txt1:'充装入库',icon:'delivery-psgl.png',url:'/pages/delivery/stock-manage/instock?stockType=1',type:1},
					{txt1:'调拨入库',icon:'delivery-dbrk.png',url:'/pages/delivery/stock-manage/instock?stockType=8',type:8},
					{txt1:'退货入库',icon:'delivery-sy.png',url:'/pages/delivery/stock-manage/instock?stockType=7',type:7},
				],
				list2:[
					{txt1:'调拨出库',icon:'delivery-rkxt.png',url:'/pages/delivery/stock-manage/outstock?stockType=5',type:5},
					{txt1:'配送出库',icon:'delivery-psyck.png',url:'/pages/delivery/stock-manage/outstock-delivery?stockType=6',type:6},
				]
			};
		},
		onLoad(options) {
			const type = options.type;
			if(type == 1){
				this.list = [...this.list1];
			}
			if(type == 2){
				this.list = [...this.list2];
			}
			uni.setNavigationBarTitle({
				title:type == 1?'入库系统':'出库系统'
			})
		},
		methods:{
			...mapMutations(['setStockType']),
			onItemClick(item){
				this.setStockType(item.type);
				if(item.url){
					uni.navigateTo({
						url:item.url
					})
				}else{
					uni.showToast({
							icon:"none",
							title:'功能开发中...'
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
.inout-stock-page{
	padding:32rpx;
	.c-panel{
		background: #FFFFFF;border-radius: 16rpx;border: 2rpx solid #FFFFFF;padding:28rpx;
	}
	.panel-1{
		gap:20rpx;
		.item{
			flex-basis: 42%;padding: 20rpx;
			.txt1{font-weight: 800;font-size: 28rpx;color: #001F42;margin-bottom:10rpx;}
			.txt2{font-weight: 400;font-size: 20rpx;color: #919191;}
			image{width:104rpx;height:104rpx;}
		}
	}
}
</style>
